#include <fstream>
#include <iostream>
#include <boost/program_options.hpp>
#include <spdlog/spdlog.h>
#include <spdlog/>


int main(int ac, char** av) {

    spdlog::set_pattern("%Y-%m-%d %H:%M:%S.%F %t %^[%l]%$ [%s:%#] [%!] %v");

    SPDLOG_INFO("dump_tickfile");

    namespace bpo = boost::program_options;
    bpo::options_description opts("hel");
    opts.add_options()
        ("spdlog_level", bpo::value<std::string>()->default_value("info"), "log level")
        ("alog,a", bpo::value<int>()->default_value(1000), "a value")
        ("product_name", bpo::value<std::vector<std::string>>(), "select product name")
        ("help", "show help message");
    bpo::variables_map config;
    bpo::store(bpo::command_line_parser(ac, av).options(opts).run(), config);
    if (config.count("help")) {
        std::cout << opts << "\n";
        return 1;
    }

    std::cout << "opts" << std::endl;
    std::cout << opts << std::endl;

    std::ifstream ifs("./config.conf");
    if (ifs) {
        std::cout << "ifs" << std::endl;
        bpo::store(bpo::parse_config_file(ifs, opts, true), config);
    } else {
        std::cout << "config" << std::endl;
    }

    std::cout << config["product_name"].as<std::vector<std::string>>()[0] << std::endl;
    std::cout << config["product_name"].as<std::vector<std::string>>()[1] << std::endl;
    std::cout << config["product_name"].as<std::vector<std::string>>()[2] << std::endl;
    std::cout << config["product_name"].as<std::vector<std::string>>()[3] << std::endl;


    return 0;
}